package com.looncin.oj.mapper;


import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.looncin.oj.model.entity.Files;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.ResultSetType;
import org.apache.ibatis.mapping.StatementType;

import java.util.Date;
import java.util.List;
import java.util.Map;


public interface FilesMapper extends BaseMapper<Files>{
    /**
     * 使用用户ID查询所有创建的文件或者文件夹
     */
    @Select("SELECT * FROM files USE INDEX (idx_creator_id) WHERE creator_id = #{creatorId}")
    List<Files> findFilesByCreatorIdWithIndex(@Param("creatorId") Long creatorId);

    @Select("CALL get_files_child_list(#{userId})")
    List<Files> getUserAccessibleFiles(@Param("userId") Long userId);


}
